package com.zmn.plat.services.impl.standard.read.permission;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zmn.plat.model.entity.standard.read.permission.OrgPermitTreeVO;
import com.zmn.plat.model.entity.standard.read.permission.StandardReadPermission;
import com.zmn.plat.model.entity.standard.read.permission.StandardReadPermissionQuery;
import com.zmn.plat.persistence.interfaces.standard.read.permission.StandardReadPermissionDao;
import com.zmn.plat.services.interfaces.standard.read.permission.StandardReadPermissionService;

@Service
public class StandardReadPermissionServiceImpl implements StandardReadPermissionService {

    @Resource
    StandardReadPermissionDao standardReadPermissionDao;

    @Override
    public StandardReadPermission findByKey(Integer id) {
        return standardReadPermissionDao.findByKey(id);
    }

    @Override
    public List<OrgPermitTreeVO> listOrgPermitTreeVOByStandardId(Integer standardId) {
        return standardReadPermissionDao.listOrgPermitTreeVOByStandardId(standardId);
    }

    @Override
    public List<StandardReadPermission> listPageByQuery(StandardReadPermissionQuery query) {
        int count = countByQuery(query);
        query.setTotalCount(count);
        return standardReadPermissionDao.listPageByQuery(query);
    }

    @Override
    public List<StandardReadPermission> listByQuery(StandardReadPermissionQuery query) {
        return standardReadPermissionDao.listByQuery(query);
    }

    @Override
    public List<StandardReadPermission> listAll() {
        return standardReadPermissionDao.listAll();
    }

    @Override
    public Integer countByQuery(StandardReadPermissionQuery query) {
        return standardReadPermissionDao.countByQuery(query);
    }

    @Override
    public Integer updateByKey(StandardReadPermission standardReadPermission) {
        return standardReadPermissionDao.updateByKey(standardReadPermission);
    }

    @Override
    public Integer insert(StandardReadPermission standardReadPermission) {
        return standardReadPermissionDao.insert(standardReadPermission);
    }

    @Override
    public Integer insertBatch(List<StandardReadPermission> standardReadPermissions) {
        return standardReadPermissionDao.insertBatch(standardReadPermissions);
    }

    @Override
    public Integer deleteByKey(Integer id) {
        return standardReadPermissionDao.deleteByKey(id);
    }

    @Override
    public Integer deleteByStandardId(Integer standardId) {
        return standardReadPermissionDao.deleteByStandardId(standardId);
    }
}